package com.ssish.saas.eccs.mapper;

import com.ssish.saas.eccs.model.EmployeePlan;
import com.ssish.saas.eccs.model.EmployeePlanExample;
import com.ssish.saas.eccs.model.EmployeePlanKey;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface EmployeePlanMapper {
    long countByExample(EmployeePlanExample example);

    int deleteByExample(EmployeePlanExample example);

    @Delete({
        "delete from EMP_PLAN",
        "where EMP_PLAN_ID = #{empPlanId,jdbcType=DECIMAL}",
          "and START_DATE = #{startDate,jdbcType=TIMESTAMP}",
          "and END_DATE = #{endDate,jdbcType=TIMESTAMP}"
    })
    int deleteByPrimaryKey(EmployeePlanKey key);

    @Insert({
        "insert into EMP_PLAN (EMP_PLAN_ID, START_DATE, ",
        "END_DATE, EMPLOYEE_ID, ",
        "LASTEDIT_DATE, MC_TAKEN_DAYS, ",
        "PLAN_CODE, USER_CODE, ",
        "ACTIVE_FLAG, OCCURENCE, ",
        "ACTIVATION_DATE, CANCELLATION_DATE, ",
        "RECORD_STATUS, REACTIVATION_DATE, ",
        "EXCLUDE_EXCLUSION, AGENT_CODE, ",
        "AGENCY_CODE, BROKER_CODE, ",
        "GROSS_PREMIUM, AGENT_COMM, ",
        "MGMT_FEES, MCO_FEES, MNRB_RISK, ",
        "DEBIT_NO, UNIT_RATE, ",
        "CURRENT_LIMIT, FAMILY_LIMIT, ",
        "TAKE_OVER_DATE, DEPENDENT_ID, ",
        "POLICY_NO, MEMBER_CONTROL_NO, ",
        "CORP_CODE, ASSIGNED_CODE, ",
        "INSERT_BY, INSERT_DATE, ",
        "HIB_AMOUNT, PAYOR_MEMBER_ID)",
        "values (#{empPlanId,jdbcType=DECIMAL}, #{startDate,jdbcType=TIMESTAMP}, ",
        "#{endDate,jdbcType=TIMESTAMP}, #{employeeId,jdbcType=CHAR}, ",
        "#{lasteditDate,jdbcType=TIMESTAMP}, #{mcTakenDays,jdbcType=DECIMAL}, ",
        "#{planCode,jdbcType=VARCHAR}, #{userCode,jdbcType=VARCHAR}, ",
        "#{activeFlag,jdbcType=CHAR}, #{occurence,jdbcType=DECIMAL}, ",
        "#{activationDate,jdbcType=TIMESTAMP}, #{cancellationDate,jdbcType=TIMESTAMP}, ",
        "#{recordStatus,jdbcType=DECIMAL}, #{reactivationDate,jdbcType=TIMESTAMP}, ",
        "#{excludeExclusion,jdbcType=CHAR}, #{agentCode,jdbcType=VARCHAR}, ",
        "#{agencyCode,jdbcType=VARCHAR}, #{brokerCode,jdbcType=VARCHAR}, ",
        "#{grossPremium,jdbcType=CHAR}, #{agentComm,jdbcType=CHAR}, ",
        "#{mgmtFees,jdbcType=CHAR}, #{mcoFees,jdbcType=CHAR}, #{mnrbRisk,jdbcType=CHAR}, ",
        "#{debitNo,jdbcType=DECIMAL}, #{unitRate,jdbcType=DECIMAL}, ",
        "#{currentLimit,jdbcType=DECIMAL}, #{familyLimit,jdbcType=DECIMAL}, ",
        "#{takeOverDate,jdbcType=TIMESTAMP}, #{dependentId,jdbcType=CHAR}, ",
        "#{policyNo,jdbcType=VARCHAR}, #{memberControlNo,jdbcType=VARCHAR}, ",
        "#{corpCode,jdbcType=VARCHAR}, #{assignedCode,jdbcType=VARCHAR}, ",
        "#{insertBy,jdbcType=VARCHAR}, #{insertDate,jdbcType=TIMESTAMP}, ",
        "#{hibAmount,jdbcType=DECIMAL}, #{payorMemberId,jdbcType=VARCHAR})"
    })
    int insert(EmployeePlan record);

    int insertSelective(EmployeePlan record);

    List<EmployeePlan> selectByExample(EmployeePlanExample example);

    @Select({
        "select",
        "EMP_PLAN_ID, START_DATE, END_DATE, EMPLOYEE_ID, LASTEDIT_DATE, MC_TAKEN_DAYS, ",
        "PLAN_CODE, USER_CODE, ACTIVE_FLAG, OCCURENCE, ACTIVATION_DATE, CANCELLATION_DATE, ",
        "RECORD_STATUS, REACTIVATION_DATE, EXCLUDE_EXCLUSION, AGENT_CODE, AGENCY_CODE, ",
        "BROKER_CODE, GROSS_PREMIUM, AGENT_COMM, MGMT_FEES, MCO_FEES, MNRB_RISK, DEBIT_NO, ",
        "UNIT_RATE, CURRENT_LIMIT, FAMILY_LIMIT, TAKE_OVER_DATE, DEPENDENT_ID, POLICY_NO, ",
        "MEMBER_CONTROL_NO, CORP_CODE, ASSIGNED_CODE, INSERT_BY, INSERT_DATE, HIB_AMOUNT, ",
        "PAYOR_MEMBER_ID",
        "from EMP_PLAN",
        "where EMP_PLAN_ID = #{empPlanId,jdbcType=DECIMAL}",
          "and START_DATE = #{startDate,jdbcType=TIMESTAMP}",
          "and END_DATE = #{endDate,jdbcType=TIMESTAMP}"
    })
    @ResultMap("com.ssish.saas.eccs.mapper.EmployeePlanMapper.BaseResultMap")
    EmployeePlan selectByPrimaryKey(EmployeePlanKey key);

    int updateByExampleSelective(@Param("record") EmployeePlan record, @Param("example") EmployeePlanExample example);

    int updateByExample(@Param("record") EmployeePlan record, @Param("example") EmployeePlanExample example);

    int updateByPrimaryKeySelective(EmployeePlan record);

    @Update({
        "update EMP_PLAN",
        "set EMPLOYEE_ID = #{employeeId,jdbcType=CHAR},",
          "LASTEDIT_DATE = #{lasteditDate,jdbcType=TIMESTAMP},",
          "MC_TAKEN_DAYS = #{mcTakenDays,jdbcType=DECIMAL},",
          "PLAN_CODE = #{planCode,jdbcType=VARCHAR},",
          "USER_CODE = #{userCode,jdbcType=VARCHAR},",
          "ACTIVE_FLAG = #{activeFlag,jdbcType=CHAR},",
          "OCCURENCE = #{occurence,jdbcType=DECIMAL},",
          "ACTIVATION_DATE = #{activationDate,jdbcType=TIMESTAMP},",
          "CANCELLATION_DATE = #{cancellationDate,jdbcType=TIMESTAMP},",
          "RECORD_STATUS = #{recordStatus,jdbcType=DECIMAL},",
          "REACTIVATION_DATE = #{reactivationDate,jdbcType=TIMESTAMP},",
          "EXCLUDE_EXCLUSION = #{excludeExclusion,jdbcType=CHAR},",
          "AGENT_CODE = #{agentCode,jdbcType=VARCHAR},",
          "AGENCY_CODE = #{agencyCode,jdbcType=VARCHAR},",
          "BROKER_CODE = #{brokerCode,jdbcType=VARCHAR},",
          "GROSS_PREMIUM = #{grossPremium,jdbcType=CHAR},",
          "AGENT_COMM = #{agentComm,jdbcType=CHAR},",
          "MGMT_FEES = #{mgmtFees,jdbcType=CHAR},",
          "MCO_FEES = #{mcoFees,jdbcType=CHAR},",
          "MNRB_RISK = #{mnrbRisk,jdbcType=CHAR},",
          "DEBIT_NO = #{debitNo,jdbcType=DECIMAL},",
          "UNIT_RATE = #{unitRate,jdbcType=DECIMAL},",
          "CURRENT_LIMIT = #{currentLimit,jdbcType=DECIMAL},",
          "FAMILY_LIMIT = #{familyLimit,jdbcType=DECIMAL},",
          "TAKE_OVER_DATE = #{takeOverDate,jdbcType=TIMESTAMP},",
          "DEPENDENT_ID = #{dependentId,jdbcType=CHAR},",
          "POLICY_NO = #{policyNo,jdbcType=VARCHAR},",
          "MEMBER_CONTROL_NO = #{memberControlNo,jdbcType=VARCHAR},",
          "CORP_CODE = #{corpCode,jdbcType=VARCHAR},",
          "ASSIGNED_CODE = #{assignedCode,jdbcType=VARCHAR},",
          "INSERT_BY = #{insertBy,jdbcType=VARCHAR},",
          "INSERT_DATE = #{insertDate,jdbcType=TIMESTAMP},",
          "HIB_AMOUNT = #{hibAmount,jdbcType=DECIMAL},",
          "PAYOR_MEMBER_ID = #{payorMemberId,jdbcType=VARCHAR}",
        "where EMP_PLAN_ID = #{empPlanId,jdbcType=DECIMAL}",
          "and START_DATE = #{startDate,jdbcType=TIMESTAMP}",
          "and END_DATE = #{endDate,jdbcType=TIMESTAMP}"
    })
    int updateByPrimaryKey(EmployeePlan record);


    @Select({
            "select",
            "EMP_PLAN_ID, START_DATE, END_DATE, EMPLOYEE_ID, LASTEDIT_DATE, MC_TAKEN_DAYS, ",
            "PLAN_CODE, USER_CODE, ACTIVE_FLAG, OCCURENCE, ACTIVATION_DATE, CANCELLATION_DATE, ",
            "RECORD_STATUS, REACTIVATION_DATE, EXCLUDE_EXCLUSION, AGENT_CODE, AGENCY_CODE, ",
            "BROKER_CODE, GROSS_PREMIUM, AGENT_COMM, MGMT_FEES, MCO_FEES, MNRB_RISK, DEBIT_NO, ",
            "UNIT_RATE, CURRENT_LIMIT, FAMILY_LIMIT, TAKE_OVER_DATE, DEPENDENT_ID, POLICY_NO, ",
            "MEMBER_CONTROL_NO, CORP_CODE, ASSIGNED_CODE, INSERT_BY, INSERT_DATE, HIB_AMOUNT, ",
            "PAYOR_MEMBER_ID",
            "from EMP_PLAN",
            "where EMP_PLAN_ID = #{empPlanId,jdbcType=DECIMAL}"

    })
    @ResultMap("com.ssish.saas.eccs.mapper.EmployeePlanMapper.BaseResultMap")
    EmployeePlan selectByPrimaryKeyNoData(EmployeePlanKey key);
}